package com.leadingsoft.pwxk.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.leadingsoft.pwxk.converter.AirPollutionConverter;
import com.leadingsoft.pwxk.dto.AirPollutionDto;
import com.leadingsoft.pwxk.model.AirPollution;
import com.leadingsoft.pwxk.repository.AirPollutionRepository;
import com.leadingsoft.pwxk.service.AirPollutionService;

/**
 * @author: lipan 2018年5月17日
 * @description: ( 大气污染 -排放口信息 )
 * 
 */

@Service
public class AirPollutionServiceImpl implements AirPollutionService {

	@Autowired
	private AirPollutionRepository airPollutionRepository;

	@Autowired
	private AirPollutionConverter airPollutionConverter;

	@Override
	public AirPollutionDto get(String dataid) {
		List<AirPollution> findByDataid = airPollutionRepository.findByDataid(dataid);
		return airPollutionConverter.toDto(findByDataid == null ? null : findByDataid.get(0));
	}

	@Override
	public List<AirPollutionDto> findByDataId(String dataid) {
		return airPollutionConverter.toDto(airPollutionRepository.findByDataid(dataid));
	}

}
